package org.coder.xml;

import org.coder.api.EchoService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @description: 服务方调用
 * @author: coder97
 * @since: 2021/03/15
 */
public class EchoConsumer {

    public static void main(String[] args) throws Exception {
        // 加载配置文件
        final ClassPathXmlApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("/spring/echo-consumer.xml");
        // 从spring容器中获取Bean
        final EchoService echoService = (EchoService) applicationContext.getBean("echoService");
        // 接口调用
        final String echoResult = echoService.echo("hello dubbo");
        System.out.println("--------------------------");
        System.out.println(echoResult);
        System.out.println("--------------------------");
        System.in.read();
    }

}